home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
drdobbs
/
1987
/
06
/
bbs.l4
< prev
next >
Wrap
Text File
|
1987-05-05
|
1KB
|
57 lines
Listing Four
readmsg
1 FIRST=/u/bbs/.first
2 LAST=/u/bbs/.last
3 MSG=/u/bbs/msg
4 echo 'who am i | cut -f1 -d" " ' ' date | cut -c1-16' "readmsg" >>/u/bbs/log.file
5 echo
# display the number of the first and last messages available
6 echo "Messages available:"
7 cat $FIRST
8 echo "through"
9 cat $LAST
10 echo
# accept the number of the first message to be displayed
11 echo "Message number to read ('q' to quit): \c"
12 read message
# loop until the user wants to quit
13 while [ "$message" != q ]
14 do
15 echo
# verify that the message number entered actually exists
16 if [ -f $MSG/$message ]
17 then
# display the message
18 cat $MSG/$message
19 elif [ "$message" != q ]
20 then
# the entered message number doesn't exist
21 echo "Sorry. That message doesn't exist."
22 fi
23 echo
# accept the next message number to read
24 echo "Message number to read: ('q' to quit): \c"
25 read message
26 done
27 echo